//饿汉模式
public class Singleton {
    private static final Singleton instance = new Singleton();
    private Singleton(){
        //防止反射攻击
        if(instance!=null){
            throw new IllegalMonitorStateException("Instance has already created");

        }
    }
    public static Singleton getInstance(){
        return instance;
    }
}
